#include<bits/stdc++.h>
using namespace std;

int main()
{

    int n, q; cin >> n >> q;
    string s;
    cin >> s; s = " " + s;
    for (int i = 0; i < q; i++)
    {
        int op; cin >> op;
        if (op ==1)
        {
            int pos = s.find('1');
            if (pos != -1)cout << pos << endl;
            else cout << -1 << endl;
        }
        if (op == 2)
        {
            int x; cin >> x;
            if (s[x] == 1)s[x] = 0;
            else s[x] = 1;
        }
    }
    return 0;
}



#include <bits/stdc++.h>
using namespace std;
int main()
{
    int n, q;
    cin >> n >> q;
    string s;
    cin >> s; s = " " + s;
    int op, x;
    while (q--)
    {
        cin >> op;
        if (op == 1)
        {
            int pos = s.find('1');
            if (pos != -1) cout << pos << endl;
            else cout << -1 << endl;
        }
        else
        {
            cin >> x;
            if (s[x] == '1') s[x] = '0';
            else s[x] = '1';
        }
    }
    return 0;
}